package com.pattern.structural.adaptor.class2.aoptest;

import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @Description  An aspect, could including many advices.
 * @Author Ping
 * @Date 2022/3/29 15:10
 **/
@Component
@Aspect
public class LogNewAspect {

    /**
     * define a point-cut: join points expression.
     */
    @Pointcut(value="execution(* com.pattern.structural.adaptor.class2.aoptest.AopApplication.*(..))")
    public void beforeLogPointCut() {

    }


    /**
     * an advice, define a logging logic to be weaved before defined method, by
     * @Before annoation. The annotation should provide a point-cut .
     */
    @Before(value="beforeLogPointCut()")
    public void beforeLogAdvice() {
        System.out.println("[LOG] the method was invoked.") ;
    }

}
